package com.leyou.item.api;

import com.leyou.item.pojo.SpecGroup;
import com.leyou.item.pojo.SpecParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Author: wzh
 * @Date: 2019/3/29 22:49
 * @Description:
 */
@RequestMapping("spec")
public interface SpecificationApi {
    /**
     * 查询参数的集合
     * @param gid 规格组id 根据规格组id查询规格参数
     * @param cid 商品分类id 根据商品分类id查询规格参数
     * @param searching 是否用于搜索过滤，true或false
     * @param generic 是否是sku通用属性，true或false
     * @return
     */
    @GetMapping("/params")
    List<SpecParam> queryParamList(
            @RequestParam(value="gid", required = false) Long gid,
            @RequestParam(value="cid", required = false) Long cid,
            @RequestParam(value="searching", required = false) Boolean searching,
            @RequestParam(value="generic", required = false) Boolean generic);

    // 查询规格参数组
    @GetMapping("{cid}")
    List<SpecGroup> querySpecsByCid(@PathVariable("cid") Long cid);

    //查询规格组中的参数
    @GetMapping("/params")
    List<SpecParam> querySpecParam(
            @RequestParam(value = "gid", required = false) Long gid,
            @RequestParam(value = "cid", required = false) Long cid,
            @RequestParam(value = "searching", required = false) Boolean searching,
            @RequestParam(value = "generic", required = false) Boolean generic);

}
